import { PORT1 } from "@/api/config/servicePort";
import Http from "@/api/index";

export const getRegion = (params: any) => {
  return Http.get(PORT1 + "/system/region/list", params);
};

export const addRegion = (params: any) => {
  return Http.post(PORT1 + "/system/region/add", params);
};

export const editRegion = (params: any) => {
  return Http.put(PORT1 + "/system/region/edit", params);
};

export const deleteRegion = (params: any) => {
  return Http.post(PORT1 + "/system/region/delete", params);
};

export const setHot = (params: any) => {
  return Http.post(PORT1 + "/system/region/set_hot", params);
};

export const setDefault = (params: any) => {
  return Http.post(PORT1 + "/system/region/set_default", params);
};

const baseUrl = PORT1 + "/system/region/loupan_name";

export const createLou = (params: any) => {
  return Http.post(baseUrl + "/add", params);
};

export const editLou = (params: any) => {
  return Http.put(baseUrl + "/edit", params);
};

export const deleteLou = (params: any) => {
  return Http.post(baseUrl + "/delete", params);
};

export const listLou = (params: any) => {
  return Http.get(baseUrl + "/list", params);
};

export const listNameByAccount = (params: any) => {
  return Http.get(baseUrl + "/name_list", params);
};

// 设置站长的列表
const baseUrl1 = PORT1 + "/system/region";

export const getSiteAccountList = (params: any) => {
  return Http.get(baseUrl1 + "/account_list", params);
};

export const setSite = (params: any) => {
  return Http.post(baseUrl1 + "/set_site", params);
};

export const releaseSite = (params: any) => {
  return Http.post(baseUrl1 + "/release_site", params);
};

// 获取管理的站点
export const getSiteManageList = () => {
  return Http.get(baseUrl1 + "/site_list");
};

// 站点登录
export const loginSiteIn = (id: any) => {
  return Http.post(baseUrl1 + "/set_site_login?id=" + id);
};
